﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString != null && Request.QueryString.Count > 0)
                Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["FriendWebSite"]);
        }
    }

    protected void LoginButton_Click(object sender, EventArgs e)
    {
        if (Membership.ValidateUser(tbAccount.Text, Password.Text))
        {
            var profile = Profile.GetProfile(tbAccount.Text);
            profile.IsFirstVisitAfterLogin = true;
            profile.Save();
            FormsAuthentication.RedirectFromLoginPage(tbAccount.Text, true);
        }
        else
        {
            lbInfo.Text = "帐号或密码错误";
        }
    }
}